Returning the Objects of BusObject Class |
|
WS-AppServer supports returning objects of theBusObjectclass or theBusObjectIteratorclass, apart from returning the basic data types.
Method Implementation
The following is a sample implementation of a method that returns an object.
<implementation type="BsfJavaCall"> <class>ITEM</class> <method ct="tuples" dt="java:ITEM[]" scope="out">getITEMObjects</method> <parameters> <fromCODE dt="int"/> <toCODE dt="int"/> </parameters> </implementation>
Note: The ct (data type) attribute in this element has been set to tuples, which indicates that the result is returned in the standard WCP tuple format. If you do not specify the attribute, the result returns the data in the format of the WCP JavaCall handler.
Sample Java Code
This example shows the java code used to return an object.
public static BusObjectEnumeration getITEMObjects(int fromCODE, int toCODE) { String queryText = "select * from ITEM where CODE between :fromCODE and :toCODE"; QueryObject query = new QueryObject(queryText); query.addParameter("fromCODE", "ITEM.CODE", QueryObject.PARAM_INT, new Integer(fromCODE)); query.addParameter("toCODE", "ITEM.CODE", QueryObject.PARAM_INT, new Integer(toCODE)); query.setResultClass(ITEM.class); return query.getObjects(); }
Sample SOAP Request
This example shows the SOAP request used to return an object.
<SOAP:Envelopexmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP:Body> <getITEMObjects xmlns="http://BSFDeployement"> <fromCODE>1</fromCODE> <toCODE>100</toCODE> </getITEMObjects> </SOAP:Body> </SOAP:Envelope>